package com.example.r2dbc.repository;

import com.example.r2dbc.entity.Author;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

import java.util.Collection;

@Repository
public interface AuthorRepository extends R2dbcRepository<Author, Long> {

    /**
     * 方法起名
     * 单表查询
     *
     * @param id
     * @param name
     * @return
     */
    Flux<Author> findAllByIdInAndNameLike(Collection<Long> id, String name);

    /**
     * 自定义@Query注解
     * 单表查询
     *
     * @return
     */
    @Query("select * from author")
    Flux<Author> find();

}
